package AIGUI;


import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
//import java.util.Base64;

 public class MyAIApp {
    public MyAIApp() {
        // 创建主窗口
        JFrame mainFrame = new JFrame("MyAI");
        mainFrame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
        mainFrame.setSize(400, 300);
        mainFrame.setLayout(new BorderLayout());

        // 创建标题
        JLabel titleLabel = new JLabel("欢迎来到MyAI!", JLabel.CENTER);
        titleLabel.setFont(new Font("微软雅黑", Font.BOLD, 24));
        mainFrame.add(titleLabel, BorderLayout.NORTH);

        // 创建按钮面板
        JPanel buttonPanel = new JPanel();
        buttonPanel.setLayout(new GridLayout(3, 1, 10, 10));

        // 创建按钮
        JButton chatButton = new JButton("AI智能对话");
        JButton text2ImageButton = new JButton("AI生成图片");
        JButton image2TextButton = new JButton("AI图生文");

        // 添加按钮到面板
        buttonPanel.add(chatButton);
        buttonPanel.add(text2ImageButton);
        buttonPanel.add(image2TextButton);

        mainFrame.add(buttonPanel, BorderLayout.CENTER);

        // 添加按钮点击事件监听器
        chatButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                SwingUtilities.invokeLater(() -> new TalkTOAI().createAndShowGUI());
            }
        });

        text2ImageButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                SwingUtilities.invokeLater(() -> new GPICGUI().createAndShowGUI());
            }
        });

        image2TextButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                SwingUtilities.invokeLater(() -> new UDSPICGUI().createAndShowGUI());
            }
        });

        // 显示主窗口
        mainFrame.setVisible(true);
    }
}
